package com.rcadmin.busi.stat.dao;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import com.rcadmin.busi.stat.ddl.StatDailyAccess;
import com.rcadmin.core.jpa.BaseDao;

/**
 * 日访问统计DAO
 * 
 * @author tanson lam
 * @createDate 2014年12月2日
 * 
 */
@Component
public class StatDailyAccessDao {

	@Resource
	private BaseDao baseDao;

	/**
	 * 查询指定日期范围内的用户网站的访问统计记录
	 * 
	 * @param userId
	 * @param startDay
	 * @param endDay
	 * @return
	 */
	public List<StatDailyAccess> findByDay(Integer userId, String startDay,
			String endDay) {
		StringBuilder query = new StringBuilder();
		query.append(" and user_id = ").append(userId);
		query.append(" and day").append(">=").append("'" + startDay + "'");
		query.append(" and day").append("<=").append("'" + endDay + "'");
		return baseDao.find(query.toString(), StatDailyAccess.class);
	}

}
